package com.ztgf.commodity.api.client;

import com.ztgf.commodity.models.bo.CommodityApplyAgentSaveBO;
import com.ztgf.commodity.models.service.ICommodityApplyAgentService;
import com.ztgf.common.constant.Result;
import com.ztgf.common.enums.CodeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品代理申请表控制器
 *
 * @author chenyu.wang
 * @Date 2020-06-23 17:07:09
 */

@RestController
@RequestMapping("/api/commodityApplyAgent")
@Slf4j
@Api(value = "CommodityApplyAgentApiController", tags = "商品代理申请表Api接口")
public class CommodityApplyAgentApiController {

    @DubboReference
    private ICommodityApplyAgentService commodityApplyAgentService;

    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加申请代理", notes = "添加申请代理")
    public Result insert(CommodityApplyAgentSaveBO saveBO) {
        boolean flag = commodityApplyAgentService.add(saveBO);
        if (flag) {
            return new Result<>();
        }
        return new Result<>(CodeEnum.FAIL_100007);
    }
}
